<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{$ChannelName}|{$Title}-{$WebName}</title>
<include file="Public:meta" />
<script type="text/javascript" src="{$WebPublic}jquery/jquery.form.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$('#frmOrder').ajaxForm({
			success: complete,
			dataType: 'json',
			beforeSubmit: check
		});
		
		function check(){
			<ordermodellist id="f">
					<eq name="f.IsRequire" value="1">
							if($("#{$f.FieldName}").val()==""){
								alert("{$f.DisplayName}{$Think.lang.Required}");
								$("#{$f.FieldName}").focus();
								return false;
							}
					</eq>
					
					<eq name="f.IsValidate" value="1">
					<notempty name="f.ValidateRule">
							var re = new RegExp("{$f.ValidateRule}");
							if(!re.test( $("#{$f.FieldName}").val() )){
								alert("{$f.DisplayName}{$Think.lang.Invalid}");
								$("#{$f.FieldName}").focus();
								return false;
							}
					</notempty>
					</eq>
			</ordermodellist>
			<eq name="OrderVerifyCode" value="1">
				if( $("#verifycode").val() == ""){
					alert("{$Think.lang.VerifyCodeRequired}");
					$("#verifycode").focus();
					return false;
				}
			</eq>
			return true;
		}
		
		function complete(data){
			if (data.status==1){
				alert(data.info);
				$('#frmOrder').resetForm();
				$("#ProductName").val("{$InfoTitle}");
            }else if(data.status==0){
				alert(data.info);
			}
			ChangeCode();
		};
		
		 $('#frmOrder').submit(function(){  // 提交表单
	     	//$('#frmAddBanner').ajaxSubmit();  
	     	return false;  //为了防止普通浏览器进行表单提交和产生页面导航（防止页面刷新？）返回false  
	     });
		 
		 $("#ProductName").val("{$InfoTitle}");
	});
</script>
<script type='text/javascript'>
	function ChangeCode(){
		var timenow = new Date().getTime();
		var obj = document.getElementById('OrderCode'); 
		if( obj ) obj.src = '{$Group}/public/orderCode/'+timenow;
	}
</script>
</head>
<body class="body_article">
	<include file="Public:header" />
    <!--主体内容 开始-->
    <div class="article">
    	<!--左侧区域 开始-->
        <div id="left">
            <include file="Public:subchannel" />
            <include file="Public:search" />
            <include file="Public:contact" />
        </div>         
        <!--左侧区域 结束-->
        
        <!--右侧区域 开始-->  
        <div id="right">
        	<div class="right_title">
            		<include file="Public:location" />
                   <h2>{$ChannelName}</h2>
            </div>
            <div class="right_body">
                <table class="order_table">
                    <form enctype="multipart/form-data" method="post" id="frmOrder" action="{$OrderAction}">
                    <ordermodellist id="f">
                        <tr>
                        	<th> {$f.DisplayName}&nbsp;<eq name='f.IsRequire' value='1'><span class="Require">*</span></eq></th>
                            <td>
                            <switch name="f.DisplayType">
                                <case value="textarea">
                                    <textarea id="{$f.FieldName}"   name="{$f.FieldName}" class="form_textarea">{$f.DisplayValue}</textarea>
                                </case>
                                <case value="radio">
                                    <volist name="f.Item" id="it">
                                           <input id="{$f.FieldName}" name="{$f.FieldName}" type="radio" class="form_radio"  value="{$it.Value}"  {$it.Selected}  />{$it.Text}&nbsp;&nbsp;
                                    </volist>
                                </case>
                               <case value="checkbox">
                                    <volist name="f.Item" id="it">
                                            <input id="{$f.FieldName}"  class="checkbox"   name="{$f.FieldName}[]" value="{$it.Value}" type="checkbox" {$it.Selected} />{$it.Text}&nbsp;&nbsp;
                                    </volist>
                                </case>
                                <case value="select">
                                    <select  id="{$f.FieldName}"  name="{$f.FieldName}" >
                                        <volist name="f.Item" id="it">
                                               <option  value="{$it.Value}"  {$it.Selected} >{$it.Text}</option>
                                        </volist>
                                     </select>
                                </case>
                                <case value="label">{$f.DisplayValue}</case>
                                <case value="password"><input id="{$f.FieldName}" name="{$f.FieldName}" type="password"   class="form_text"  value="{$f.DisplayValue}" /></case>
                                <default /><input id="{$f.FieldName}" name="{$f.FieldName}" type="text"   class="form_text"  maxlength="100"   value="{$f.DisplayValue}" />
                             </switch>
                             </td>
                         </tr>
                    </ordermodellist>
                    
                    <eq name="OrderVerifyCode" value="1"> 
                        <tr>
                            <th>{$Think.lang.Verifycode}<span class="required">*</span></th>
                            <td>
                                <input id="verifycode" class="form_text_verifycode" name="verifycode" type="text" maxlength="4" />
                                <img  src='{$Group}/public/orderCode/'  onclick='ChangeCode()' class="code_image" id='OrderCode'  align='absMiddle' />
                            </td>
                        </tr>
                    </eq>
                    <tr>
                         <th colspan="2" class="operation">
                        	 <input class="form_button btn" type="submit" name="submit8" value="{$Think.lang.Submit}" />
                         </th>
                    </tr>
                    </form>
                </table>
            </div>
            <div class="right_bottom"></div>
        </div>
        <!--右侧区域 结束--> 
        <div class="clear"></div>
	</div>
    <!--主体内容 结束-->
    <include file="Public:footer" />
</body>
</html>